<template>
  <div>
    <Input
      v-model="value"
      maxlength="100"
      show-word-limit
      type="textarea"
      placeholder="输入你的评论.."
      :rows="6"
    />
    <br />
    <br />
    <button class="btn" long type="primary" @click="submit">提交</button>
  </div>
</template>

<script>
export default {
  props: {
    id: {
      type: Number,
      default: 1
    }
  },
  data() {
    return {
      value: ""
    };
  },
  methods: {
    submit() {
      this.$api.comment.add(this.id, this.value).then(data => {
        this.$toast.success("发布成功");
        this.value = "";
        this.$emit("on-add", data);
      });
    }
  }
};
</script>

<style lang="scss" scoped></style>
